class Solution {
    public:
        bool asteroidsDestroyed(int mass, vector<int>& asteroids) {
            unsigned long long masss=mass;
            sort(asteroids.begin(),asteroids.end());
            for(int i=0;i<asteroids.size();i++){
                if(masss>=asteroids[i]){
                    masss+=asteroids[i];
                    if(i==asteroids.size()-1){
                        return true;
                    }
                }else{
                    return false;
                }
            }
            return true;
        }
    };